<template>
	<view class="page" style="padding-top: 64px;background-color: #f4f4f4;">
		<navview title="广场"></navview>


		<view class="" style="flex: 1;display: block;padding-left: 12px;padding-right: 12px;padding-bottom: 12px;overflow: scroll;">
			<!-- 搜索 -->
			<view style="flex-direction: row;padding-top: 12px;">
				<view style="flex: 1;align-items: center;flex-direction: row;background-color: #FFFFFF;padding: 10px;padding-left: 15px;border-radius: 20px;">
					<input type="text" value="" placeholder="输入关键词搜索" confirm-type="search" style="flex: 1;font-size: 14px;" />
					<text class="iconfont iconqingchu" style="color: #999999;"></text>
				</view>
			</view>


			<!-- item -->
			<view v-for="(obj,idx) in topicList" :key="idx" @click="loadSubPage(obj)" style="position: relative;
			height: 190px;
			border-radius: 10px;
			margin-top: 12px;
			overflow: hidden;">
				<view style="flex: 1;background-color: #007AFF;">
					<image :src="obj.imgs" style="width: 100%;"></image>
				</view>
			</view>
		</view>


	</view>
</template>

<script>
	import navview from "@/cmps/navview.vue"
	export default {
		components: {
			navview
		},
		data() {
			return {
				title: 'Hello22',
				topicList: [],
			}
		},
		onLoad() {},
		onShow() {
			this.netFetchTopicList()
		},
		methods: {
			netFetchTopicList() {
				let self = this
				uni.request({
					url: this.BASEURL + "/topic/list",
					success: ({
						data
					}) => {
						let code = data['code']
						let msg = data['msg']
						if (code == 0) {
							let info = data['data']
							self.topicList = info
						} else {
							debugger
							console.log(msg)
						}
					}
				})
			},


			loadSubPage(obj) {
				uni.navigateTo({
					url: "/pages/subhome/index?obj=" + encodeURIComponent(JSON.stringify(obj)),
					complete: () => {
						setTimeout(()=>{
						console.log('111111111');
						uni.$emit("param",obj)
							
						},300)
					}
				})
			}

		}
	}
</script>

<style>
	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>
